<template>
    <div class="cart">
        <h2>你的购物车</h2>
        <p>
            <i>请添加到购物车</i>
        </p>

        <ul>
            <li v-for="item in cartStore.cartProducts" :key="item.id">{{item.title}}---{{item.price}}x{{item.quanlitity}}</li>
        </ul>

        <p>{{cartStore.totalPrice}}</p>
        <p><button @click="cartStore.checkout">结算</button></p>
        <p v-if="cartStore.checkoutStatus">结算{{cartStore.checkoutStatus}}</p>
    </div>
</template>

<script setup lang="ts">
import {useCartStore} from '../store/cart'
const cartStore=useCartStore()

</script>